
package com.shop.cloud.mall.api.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.cloud.common.core.util.R;
import com.shop.cloud.mall.api.service.ActiveBorderService;
import com.shop.cloud.mall.common.entity.ActiveBorder;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * 活动边框
 *
 * @author
 * @date 2023-03-24 10:31:48
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/activeborder")
@Tag(description = "activeborder", name = "活动边框API")
public class ActiveBorderController {

    private final ActiveBorderService activeBorderService;

    /**
     * 活动边框分页列表
     * @param page 分页对象
     * @param activeBorder 活动边框
     * @return
     */
    @Operation(summary = "活动边框分页列表")
    @GetMapping("/page")
    public R getPage(Page page, ActiveBorder activeBorder) {
        return R.ok(activeBorderService.page(page, Wrappers.query(activeBorder)));
    }

    /**
     * 活动边框查询
     * @param id
     * @return R
     */
    @Operation(summary = "活动边框查询")
    @GetMapping("/{id}")
    public R getById(@PathVariable("id") String id) {
        return R.ok(activeBorderService.getById(id));
    }

    /**
     * 活动边框新增
     * @param activeBorder 活动边框
     * @return R
     */
    @Operation(summary = "活动边框新增")
    @PostMapping
    public R save(@RequestBody ActiveBorder activeBorder) {
        return R.ok(activeBorderService.save(activeBorder));
    }

    /**
     * 活动边框修改
     * @param activeBorder 活动边框
     * @return R
     */
    @Operation(summary = "活动边框修改")
    @PutMapping
    public R updateById(@RequestBody ActiveBorder activeBorder) {
        return R.ok(activeBorderService.updateById(activeBorder));
    }

    /**
     * 活动边框删除
     * @param id
     * @return R
     */
    @Operation(summary = "活动边框删除")
    @DeleteMapping("/{id}")
    public R removeById(@PathVariable String id) {
        return R.ok(activeBorderService.removeById(id));
    }

}
